/*
 * @FilePath: /vue3-ts-h5-template/src/stores/index.ts
 */
import { createStore, createLogger } from 'vuex';
import createPersistedState from 'vuex-persistedstate';
import { name } from '../../package.json';
import cachedView from './modules/cached-view';
import loading from './modules/loading';
import themeMode from './modules/theme-mode';
const store = createStore({
  strict: true, // 严格模式
  modules: {
    cachedView,
    loading,
    themeMode
  },
  plugins: [
    createPersistedState({
      key: `${name}_vuex_`,
      paths: ['themeMode']
    }),
    createLogger({
      logActions: true,
      logMutations: true,
      logger: console
    }) // 内置日志打印
  ]
});

export default store;
